#!/bin/bash
echo "Raspbery administration deploy started!"
sudo apt update && sudo apt -y dist-upgrade
sudo apt-get install python-pip


sudo apt-get install gunicorn mysql-client mysql-server python-mysqldb


pip install venv
pip install requirements.txt
virtualenv myappenv
# настройка Mysql------------
mysql CREATE DATABASE `new_db`


python manage.py migrate
python manage.py migrate --run-syncdb
python manage.py createsuperuser --username "admin5" --email adm@yandex.ru

uvicorn malina_admin.asgi:application --host 127.0.0.1 --port 8000

##--------------------------------------------
root@test1:~# debconf-get-selections | grep mysql-server
mysql-server-5.5        mysql-server/root_password_again        password
mysql-server-5.5        mysql-server/root_password      password
mysql-server-5.5        mysql-server/error_setting_password     error
mysql-server-5.5        mysql-server-5.5/postrm_remove_databases        boolean false
mysql-server-5.5        mysql-server-5.5/start_on_boot  boolean true
mysql-server-5.5        mysql-server-5.5/nis_warning    note
mysql-server-5.5        mysql-server-5.5/really_downgrade       boolean false
mysql-server-5.5        mysql-server/password_mismatch  error
mysql-server-5.5        mysql-server/no_upgrade_when_using_ndb  error

There's some noise there, but the important part is the password settings.

Then, for a fresh install, you can avoid the prompts completely by setting the password beforehand:

root@test2:~# echo "mysql-server-5.5 mysql-server/root_password_again password Som3Passw0rd" | debconf-set-selections
root@test2:~# echo "mysql-server-5.5 mysql-server/root_password password Som3Passw0rd" | debconf-set-selections
root@test2:~# apt-get install mysql-server
